package com.avalon.erp.addon.pet.service.user;

import com.avalon.core.exception.AvalonException;
import com.avalon.core.field.Field;
import com.avalon.core.field.Fields;
import com.avalon.core.model.RecordRow;
import com.avalon.core.service.AbstractService;
import com.avalon.erp.addon.pet.model.enums.PetSexEnum;
import com.avalon.erp.addon.pet.model.enums.WeightTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class PetService extends AbstractService {
    @Override
    public String getServiceName() {
        return "pet.pet";
    }

    @Override
    protected Field createNameField() {
        return Fields.createString("宠物名", true);
    }

    protected final Field petUserId = Fields.createMany2one("宠物主",
            "pet.user");
    protected final Field petBigTypeId = Fields.createMany2one("大类", "pet.big.type");
    protected final Field petSmallTypeId = Fields.createMany2one("小类", "pet.small.type");
    protected final Field petAge = Fields.createInteger("年龄");
    protected final Field petSex = Fields.createSelection("性别", PetSexEnum.class);
    protected final Field weight = Fields.createBigDecimal("体重", 10, 2);
    protected final Field weightType = Fields.createSelection("体型类别", WeightTypeEnum.class);
    protected final Field avatar = Fields.createImage("头像");
    protected final Field coatColor = Fields.createString("毛色");
    protected final Field isSterilization = Fields.createBoolean("绝育");
    protected final Field vaccination = Fields.createString("疫苗");
    protected final Field isDeworming = Fields.createBoolean("驱虫");
    protected final Field nature = Fields.createString("性格");
    protected final Field birthDate = Fields.createDate("出生日期");


    @Override
    protected void checkInsert(RecordRow recordRow) throws AvalonException {
        super.checkInsert(recordRow);
    }
}
